package com.linuxgt.mobile;

/**
 * Created by LIUTENG on 2015-04-29.
 */
public class Ring {
    private double innerRadius;
    private double outerRadius;
    private String color;

    public double getInnerRadius() {
        return innerRadius;
    }

    public void setInnerRadius(double innerRadius) {
        this.innerRadius = innerRadius;
    }

    public Ring(double innerRadius, double outerRadius, String color) {

        this.innerRadius = innerRadius;
        this.outerRadius = outerRadius;
        this.color = color;
    }

    public double getOuterRadius() {
        return outerRadius;
    }

    public void setOuterRadius(double outerRadius) {
        this.outerRadius = outerRadius;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    @Override
    public String toString() {
        return  "圆环的内半径：" + innerRadius + "\n" +
                "圆环的外半径：" + outerRadius + "\n" +
                "圆环的颜色：" + color + "\n" +
                "圆环的面积：" + getArea() + "\n";
    }

    public double getArea() {
        return Math.PI * (outerRadius * outerRadius - innerRadius * innerRadius);
    }

    public static void main(String[] args) {
        Ring R1 = new Ring(5.0, 8.0, "red");
        Ring R2 = new Ring(4.0, 6.0, "blue");
        System.out.println(R1);
        System.out.println(R2);
    }
}
